From 672fb6087992df7a6232609ec4e37b4505a8f365 Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Sun, 8 Oct 2017 22:19:22 -0400 Subject: [PATCH] snapshot: Use a better placeholder An empty container has the same effect as transparency with the cairo renderer, but creates black with Vulkan. To avoid this, explicitly use a transparent color node. This fixes the css blendmode example in gtk4-demo with the Vulkan renderer. --- gtk/gtksnapshot.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/gtk/gtksnapshot.c b/gtk/gtksnapshot.c index 5d2a7f18f6..2f72614443 100644 --- a/gtk/gtksnapshot.c +++ b/gtk/gtksnapshot.c @@ -746,15 +746,18 @@ gtk_snapshot_collect_blend_top (GtkSnapshot *snapshot, const char *name) { GskRenderNode *bottom_node, *top_node, *blend_node; + GdkRGBA transparent = { 0, 0, 0, 0 }; top_node = gtk_snapshot_collect_default (snapshot, state, nodes, n_nodes, name); bottom_node = state->data.blend.bottom_node; + g_assert (top_node != NULL || bottom_node != NULL); + /* XXX: Is this necessary? Do we need a NULL node? */ if (top_node == NULL) - top_node = gsk_container_node_new (NULL, 0); + top_node = gsk_color_node_new (&transparent, &bottom_node->bounds); if (bottom_node == NULL) - bottom_node = gsk_container_node_new (NULL, 0); + bottom_node = gsk_color_node_new (&transparent, &top_node->bounds); blend_node = gsk_blend_node_new (bottom_node, top_node, state->data.blend.blend_mode); gsk_render_node_set_name (blend_node, name); -- 2.30.2